var app = getApp();
var com = require('../../common.js');
Page({
  data: {
    OpeningStatus:''
  },
  onLoad: function(options) {
    var _this = this
    _this.onShopStatus()
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {},
  //获取开通情况
  onShopStatus() {
    var _this = this
    com.link(app.link.onShopStatus + wx.getStorageSync('store') + '.st', {}, function(res) {
      console.log(res)
      if (res.data.meituan.join == "empty") {
        _this.setData({
          OpeningStatus: 0
        })
      }
      if (res.data.meituan.join == "create") {
        _this.setData({
          OpeningStatus: 2
        })
      }
      if (res.data.meituan.join == "wait") {
        _this.setData({
          OpeningStatus: 3
        })
      }
      if (res.data.meituan.join == "success") {
        _this.setData({
          OpeningStatus: 1
        })
      }
    }, "GET")
  },
  //点击开通状态
  onOpeningTap(e) {
    var _this = this,
      type = e.currentTarget.id
    if (type == 0) {
      wx.navigateTo({
        url: '/pages/PageIndex/PageIndex',
      })
    }
    if (type == 1) {
      wx.navigateTo({
        url: '/pages/successFil/successFil',
      })
    }
    if (type == 2) {
      wx.navigateTo({
        url: "/pages/onOrderBegin/onOrderBegin",
      })
    }
    if (type == 3) {
      wx.navigateTo({
        url: '/pages/onOrderSuccess/onOrderSuccess',
      })
    }
  }
})